#!/bin/bash
nginxurl=/opt/openresty/nginx
. $nginxurl/scripts/golo.conf
rosnode kill /mo_calibrator
pkill -f calib.launch
pkill -f cam_calib.launch
RosCron=$(sudo service cron status |grep running |wc -l)
if [ $RosCron == 1 ];then
	    sudo service cron  stop  
    fi
RosWM=$(rosnode list|grep golo_monitor |wc -l)
if [ $RosWM == 1 ];then
	sudo systemctl stop goloWM && echo y |rosnode cleanup
fi
RosC=$(rosnode list|grep mo_camera |wc -l)
if [ $RosC == 1 ];then
	sudo systemctl stop goloC;echo y |rosndoe cleanup 
fi
if [ -d /home/nuc/.rtk_ws ];then
    source $ROS_RTK_WS_PATH
else
    source $ROS_ASLAM_WS_PATH
fi
moak_version=$(rosversion moak_cam_scan |awk -F'.' '{print $1 $2}')
if [ $moak_version -ge 22 ];then
	roslaunch moak_cam_scan  cam_calib.launch &
else
roslaunch moak_calib  start_calib_right.launch &
fi

